package com.yanqu.road.server.cmd.wingroom.chakra;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.WingRoomChakraProto.WingRoomChakraProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.GameProtocol;
import com.yanqu.road.utils.YanQuMessageUtils;

/**
 * @author ：zfr
 * @date ：2022/2/23 11:34
 */
@Cmd(code = CrossProtocol.C_CROSS_WING_ROOM_CHAKRA_BE_VISIT, desc = "厢房命盘-被拜访区服请求跨服")
public class WingRoomChakraBeVisitCrossCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        WingRoomChakraProto.WingRoomChakraCrossBeVisitReqMsg reqMsg = WingRoomChakraProto.WingRoomChakraCrossBeVisitReqMsg.parseFrom(packet.getBytes());
        //通知区服
        WingRoomChakraProto.WingRoomChakraBeVisitFromCrossReqMsg.Builder serverReqMsg = WingRoomChakraProto.WingRoomChakraBeVisitFromCrossReqMsg.newBuilder();
        serverReqMsg.setRet(reqMsg.getRet());
        serverReqMsg.setBeVisitUserId(reqMsg.getBeVisitUserId());
        serverReqMsg.setVisitUserId(reqMsg.getVisitUserId());
        serverReqMsg.setBeVisitServerId(reqMsg.getBeVisitServerId());
        serverReqMsg.setBeVisitWindWaterLevel(reqMsg.getBeVisitWindWaterLevel());
        serverReqMsg.setBeVisitAddRate(reqMsg.getBeVisitAddRate());
        YanQuMessage message = YanQuMessageUtils.buildMessage(GameProtocol.S_CHAKRA_BE_VISIT_FROM_CROSS, serverReqMsg);
        MessageHelper.sendPacket(reqMsg.getVisitServerId(), 0, message);
    }

    @Override
    public void sendData() {

    }
}
